using System;
using System.Data;
using System.Collections.Generic;

namespace eTMS.DAO{
	/********************************BEGIN GiaoVienDAO****************************************/
	///<summary>
	/// <para>Author: Auto generated class by CSharp Code Generator v2.0</para>
	/// <para>Date:15/10/2011 14:08:21</para>
	/// <para>Class Name: GiaoVienDAO</para>
	/// <para>Description: Class access to table GiaoVien in database. Coder should'nt code here.</para>
	///</summary>

	
	public partial class GiaoVienDAO : ADOBase.DAOBase<GiaoVienEntity>{


		#region Select functions
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: CreateSelectOneCommand</para>
		/// <para>Input: GiaoVien_ID</para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateSelectOneCommand(int GiaoVien_ID){
			string strSQL="SELECT  [GiaoVien_ID],[MaGiaoVien],[HoTenGiaoVien],[NgaySinh],[GioiTinh],[DiaChi],[Email],[DienThoai],[BoMon_ID] FROM [GiaoVien]  WHERE [GiaoVien].[GiaoVien_ID]=@GiaoVien_ID";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			this.CreateCommandParameter(cmd,"@GiaoVien_ID",GiaoVien_ID);



			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: SelectOne</para>
		/// <para>Input: GiaoVien_ID</para>
		/// <para>Output: GiaoVienEntity</para>
		///</summary>
		public GiaoVienEntity SelectOne(int GiaoVien_ID){
			IDbCommand cmd=this.CreateSelectOneCommand(GiaoVien_ID);
			return this.Select(cmd);
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: SelectOneByMaGiaoVien</para>
		/// <para>Input: MaGiaoVien</para>
		/// <para>Output: GiaoVienEntity</para>
		///</summary>
		public GiaoVienEntity SelectOneByMaGiaoVien(string MaGiaoVien){
			IDbCommand cmd=this.CreateSelectAllByKeyCommand("MaGiaoVien",MaGiaoVien);
			return this.Select(cmd);
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: CreateSelectAllCommand</para>
		/// <para>Input: </para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateSelectAllCommand(){
			string strSQL="SELECT  [GiaoVien_ID],[MaGiaoVien],[HoTenGiaoVien],[NgaySinh],[GioiTinh],[DiaChi],[Email],[DienThoai],[BoMon_ID] FROM [GiaoVien] ";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: CreateSelectAllByKeyCommand</para>
		/// <para>Input: ColumnName,ColumnValue</para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateSelectAllByKeyCommand(string ColumnName,object Value){
			string strSQL="SELECT  [GiaoVien_ID],[MaGiaoVien],[HoTenGiaoVien],[NgaySinh],[GioiTinh],[DiaChi],[Email],[DienThoai],[BoMon_ID] FROM [GiaoVien]  WHERE [GiaoVien].["+ColumnName+"]=@ColumnName";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			this.CreateCommandParameter(cmd,"@ColumnName",Value);



			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: SelectAll</para>
		/// <para>Input: </para>
		/// <para>Output: List of GiaoVienEntity</para>
		///</summary>
		public List<GiaoVienEntity> SelectAll(){
			IDbCommand cmd=this.CreateSelectAllCommand();
			return this.SelectList(cmd);
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: SelectAllDS</para>
		/// <para>Input: </para>
		/// <para>Output: DataSet</para>
		///</summary>
		public DataSet SelectAllDS(){
			IDbCommand cmd=this.CreateSelectAllCommand();
			return this.SelectDS(cmd);
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: CreateSelectAllFilterCommand</para>
		/// <para>Input: </para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateSelectAllFilterCommand(string strFilter){
			string strSQL="SELECT  [GiaoVien_ID],[MaGiaoVien],[HoTenGiaoVien],[NgaySinh],[GioiTinh],[DiaChi],[Email],[DienThoai],[BoMon_ID] FROM [GiaoVien]  WHERE "+RemoveInjection(strFilter);
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: CreateSelectAllByKeyFilterCommand</para>
		/// <para>Input: ColumnName,ColumnValue</para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateSelectAllByKeyFilterCommand(string strFilter,string ColumnName,object Value){
			string strSQL="SELECT  [GiaoVien_ID],[MaGiaoVien],[HoTenGiaoVien],[NgaySinh],[GioiTinh],[DiaChi],[Email],[DienThoai],[BoMon_ID] FROM [GiaoVien]  WHERE [GiaoVien].["+ColumnName+"]=@ColumnName AND "+RemoveInjection(strFilter);
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			this.CreateCommandParameter(cmd,"@ColumnName",Value);



			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: SelectAll</para>
		/// <para>Input: </para>
		/// <para>Output: List of GiaoVienEntity</para>
		///</summary>
		public List<GiaoVienEntity> SelectAllFilter(string strFilter){
			IDbCommand cmd=this.CreateSelectAllFilterCommand(strFilter);
			return this.SelectList(cmd);
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: SelectAllDSFilter</para>
		/// <para>Input: </para>
		/// <para>Output: DataSet</para>
		///</summary>
		public DataSet SelectAllDSFilter(string strFilter){
			IDbCommand cmd=this.CreateSelectAllFilterCommand(strFilter);
			return this.SelectDS(cmd);
		}
		#endregion

		#region Insert functions
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: CreateInsertCommand</para>
		/// <para>Input: GiaoVienEntity</para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateInsertCommand(GiaoVienEntity o){
			string strSQL="INSERT INTO [GiaoVien]([MaGiaoVien],[HoTenGiaoVien],[NgaySinh],[GioiTinh],[DiaChi],[Email],[DienThoai],[BoMon_ID]) VALUES  (@MaGiaoVien,@HoTenGiaoVien,@NgaySinh,@GioiTinh,@DiaChi,@Email,@DienThoai,@BoMon_ID);SELECT  @@IDENTITY";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			if(o.IsNullMaGiaoVien)
				this.CreateCommandParameter(cmd,"@MaGiaoVien",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@MaGiaoVien",o.MaGiaoVien);

			if(o.IsNullHoTenGiaoVien)
				this.CreateCommandParameter(cmd,"@HoTenGiaoVien",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@HoTenGiaoVien",o.HoTenGiaoVien);

			if(o.IsNullNgaySinh)
				this.CreateCommandParameter(cmd,"@NgaySinh",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@NgaySinh",o.NgaySinh);

			if(o.IsNullGioiTinh)
				this.CreateCommandParameter(cmd,"@GioiTinh",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@GioiTinh",o.GioiTinh);

			if(o.IsNullDiaChi)
				this.CreateCommandParameter(cmd,"@DiaChi",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@DiaChi",o.DiaChi);

			if(o.IsNullEmail)
				this.CreateCommandParameter(cmd,"@Email",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@Email",o.Email);

			if(o.IsNullDienThoai)
				this.CreateCommandParameter(cmd,"@DienThoai",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@DienThoai",o.DienThoai);

			if(o.IsNullBoMon_ID)
				this.CreateCommandParameter(cmd,"@BoMon_ID",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@BoMon_ID",o.BoMon_ID);


			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: Save</para>
		/// <para>Input: GiaoVienEntity</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool Save(GiaoVienEntity o){
			bool result=false;
			IDbCommand cmd=this.CreateInsertCommand(o);
			object id=this.ExecuteScalar(cmd,ref result);
			cmd.Dispose();
			try{
				o.GiaoVien_ID=int.Parse(Convert.ToString(id));
			}
			catch{}
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: SaveList</para>
		/// <para>Input: List of GiaoVienEntity</para>
		/// <para>Output: </para>
		///</summary>
		public void SaveList(List<GiaoVienEntity>list){
			foreach(GiaoVienEntity o in list){
				try{
					this.Save(o);
				}
				catch{
				}
			}
		}
		#endregion

		#region Update functions
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: CreateUpdateCommand</para>
		/// <para>Input: GiaoVienEntity</para>
		/// <para>Output: </para>
		///</summary>
		protected IDbCommand CreateUpdateCommand(GiaoVienEntity o){
			string strSQL="UPDATE  [GiaoVien] SET [GiaoVien].[MaGiaoVien]=@MaGiaoVien,[GiaoVien].[HoTenGiaoVien]=@HoTenGiaoVien,[GiaoVien].[NgaySinh]=@NgaySinh,[GiaoVien].[GioiTinh]=@GioiTinh,[GiaoVien].[DiaChi]=@DiaChi,[GiaoVien].[Email]=@Email,[GiaoVien].[DienThoai]=@DienThoai,[GiaoVien].[BoMon_ID]=@BoMon_ID WHERE [GiaoVien].[GiaoVien_ID]=@GiaoVien_ID";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			if(o.IsNullGiaoVien_ID)
				this.CreateCommandParameter(cmd,"@GiaoVien_ID",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@GiaoVien_ID",o.GiaoVien_ID);

			if(o.IsNullMaGiaoVien)
				this.CreateCommandParameter(cmd,"@MaGiaoVien",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@MaGiaoVien",o.MaGiaoVien);

			if(o.IsNullHoTenGiaoVien)
				this.CreateCommandParameter(cmd,"@HoTenGiaoVien",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@HoTenGiaoVien",o.HoTenGiaoVien);

			if(o.IsNullNgaySinh)
				this.CreateCommandParameter(cmd,"@NgaySinh",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@NgaySinh",o.NgaySinh);

			if(o.IsNullGioiTinh)
				this.CreateCommandParameter(cmd,"@GioiTinh",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@GioiTinh",o.GioiTinh);

			if(o.IsNullDiaChi)
				this.CreateCommandParameter(cmd,"@DiaChi",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@DiaChi",o.DiaChi);

			if(o.IsNullEmail)
				this.CreateCommandParameter(cmd,"@Email",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@Email",o.Email);

			if(o.IsNullDienThoai)
				this.CreateCommandParameter(cmd,"@DienThoai",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@DienThoai",o.DienThoai);

			if(o.IsNullBoMon_ID)
				this.CreateCommandParameter(cmd,"@BoMon_ID",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@BoMon_ID",o.BoMon_ID);


			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: CreateUpdateFieldCommand</para>
		/// <para>Input: ColumnName,ColumnValue,GiaoVien_ID</para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateUpdateFieldCommand(string ColumnName,object Value,int GiaoVien_ID){
			string strSQL="UPDATE  [GiaoVien] SET [GiaoVien].["+ColumnName+"]=@ColumnName WHERE [GiaoVien].[GiaoVien_ID]=@GiaoVien_ID";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			this.CreateCommandParameter(cmd,"@GiaoVien_ID",GiaoVien_ID);



			this.CreateCommandParameter(cmd,"@ColumnName",Value);


			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: Update</para>
		/// <para>Input: GiaoVienEntity</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool Update(GiaoVienEntity o){
			IDbCommand cmd=this.CreateUpdateCommand(o);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: UpdateList</para>
		/// <para>Input: List of GiaoVienEntity</para>
		/// <para>Output: </para>
		///</summary>
		public void UpdateList(List<GiaoVienEntity>list){
			foreach(GiaoVienEntity o in list){
				try{
					this.Update(o);
				}
				catch{
				}
			}
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: UpdateMaGiaoVien</para>
		/// <para>Input: NewMaGiaoVien,GiaoVien_ID</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool UpdateMaGiaoVien(string NewMaGiaoVien,int GiaoVien_ID){
			IDbCommand cmd=this.CreateUpdateFieldCommand("MaGiaoVien",NewMaGiaoVien,GiaoVien_ID);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: UpdateHoTenGiaoVien</para>
		/// <para>Input: NewHoTenGiaoVien,GiaoVien_ID</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool UpdateHoTenGiaoVien(string NewHoTenGiaoVien,int GiaoVien_ID){
			IDbCommand cmd=this.CreateUpdateFieldCommand("HoTenGiaoVien",NewHoTenGiaoVien,GiaoVien_ID);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: UpdateNgaySinh</para>
		/// <para>Input: NewNgaySinh,GiaoVien_ID</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool UpdateNgaySinh(string NewNgaySinh,int GiaoVien_ID){
			IDbCommand cmd=this.CreateUpdateFieldCommand("NgaySinh",NewNgaySinh,GiaoVien_ID);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: UpdateGioiTinh</para>
		/// <para>Input: NewGioiTinh,GiaoVien_ID</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool UpdateGioiTinh(Byte NewGioiTinh,int GiaoVien_ID){
			IDbCommand cmd=this.CreateUpdateFieldCommand("GioiTinh",NewGioiTinh,GiaoVien_ID);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: UpdateDiaChi</para>
		/// <para>Input: NewDiaChi,GiaoVien_ID</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool UpdateDiaChi(string NewDiaChi,int GiaoVien_ID){
			IDbCommand cmd=this.CreateUpdateFieldCommand("DiaChi",NewDiaChi,GiaoVien_ID);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: UpdateEmail</para>
		/// <para>Input: NewEmail,GiaoVien_ID</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool UpdateEmail(string NewEmail,int GiaoVien_ID){
			IDbCommand cmd=this.CreateUpdateFieldCommand("Email",NewEmail,GiaoVien_ID);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: UpdateDienThoai</para>
		/// <para>Input: NewDienThoai,GiaoVien_ID</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool UpdateDienThoai(string NewDienThoai,int GiaoVien_ID){
			IDbCommand cmd=this.CreateUpdateFieldCommand("DienThoai",NewDienThoai,GiaoVien_ID);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: UpdateBoMon_ID</para>
		/// <para>Input: NewBoMon_ID,GiaoVien_ID</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool UpdateBoMon_ID(int NewBoMon_ID,int GiaoVien_ID){
			IDbCommand cmd=this.CreateUpdateFieldCommand("BoMon_ID",NewBoMon_ID,GiaoVien_ID);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		#endregion

		#region Delete functions
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: DeleteAllCommand</para>
		/// <para>Input: </para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateDeleteAllCommand(){
			string strSQL="DELETE   FROM [GiaoVien]  ";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: DeleteCommand</para>
		/// <para>Input: GiaoVienEntity</para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateDeleteCommand(GiaoVienEntity o){
			string strSQL="DELETE   FROM [GiaoVien]   WHERE [GiaoVien].[GiaoVien_ID]=@GiaoVien_ID";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			if(o.IsNullGiaoVien_ID)
				this.CreateCommandParameter(cmd,"@GiaoVien_ID",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@GiaoVien_ID",o.GiaoVien_ID);


			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: DeleteAll</para>
		/// <para>Input: </para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool DeleteAll(){
			IDbCommand cmd=this.CreateDeleteAllCommand();
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: CreateDeleteByPrimaryKeyCommand</para>
		/// <para>Input: GiaoVien_ID</para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateDeleteByPrimaryKeyCommand(int GiaoVien_ID){
			string strSQL="DELETE   FROM [GiaoVien]   WHERE [GiaoVien].[GiaoVien_ID]=@GiaoVien_ID";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			this.CreateCommandParameter(cmd,"@GiaoVien_ID",GiaoVien_ID);



			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: CreateDeleteByKeyCommand</para>
		/// <para>Input: ColumnName , ColumnValue</para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateDeleteByKeyCommand(string ColumnName,object Value){
			string strSQL="DELETE   FROM [GiaoVien]   WHERE [GiaoVien].["+ColumnName+"]=@ColumnName";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			this.CreateCommandParameter(cmd,"@ColumnName",Value);



			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: Delete</para>
		/// <para>Input: GiaoVienEntity</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool Delete(GiaoVienEntity o){
			IDbCommand cmd=this.CreateDeleteCommand(o);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: DeleteByID</para>
		/// <para>Input: GiaoVien_ID</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool DeleteByID(int GiaoVien_ID){
			IDbCommand cmd=this.CreateDeleteByPrimaryKeyCommand(GiaoVien_ID);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		#endregion

		#region Select join to BoMon functions
		#endregion

		#region Select,delete by GiaoVien_ID functions
		#endregion

		#region Select,delete by BoMon_ID functions
		#endregion

		#region MapObject functions
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:15/10/2011 14:08:21</para>
		/// <para>Name: MapObject</para>
		/// <para>Input: IDataReader</para>
		/// <para>Output: GiaoVienEntity</para>
		///</summary>
		protected override GiaoVienEntity MapObject(IDataReader r){
			GiaoVienEntity entity = new GiaoVienEntity();
			try{
				if(r.FieldCount>0){
					try
					{
						int ordinal = r.GetOrdinal("GiaoVien_ID");
						if (!r.IsDBNull(ordinal)) entity.GiaoVien_ID = ((int)(r.GetValue(ordinal)));
					}
					catch{}
					try
					{
						int ordinal = r.GetOrdinal("MaGiaoVien");
						if (!r.IsDBNull(ordinal)) entity.MaGiaoVien = ((string)(r.GetValue(ordinal)));
					}
					catch{}
					try
					{
						int ordinal = r.GetOrdinal("HoTenGiaoVien");
						if (!r.IsDBNull(ordinal)) entity.HoTenGiaoVien = ((string)(r.GetValue(ordinal)));
					}
					catch{}
					try
					{
						int ordinal = r.GetOrdinal("NgaySinh");
						if (!r.IsDBNull(ordinal)) entity.NgaySinh = ((string)(r.GetValue(ordinal)));
					}
					catch{}
					try
					{
						int ordinal = r.GetOrdinal("GioiTinh");
						if (!r.IsDBNull(ordinal)) entity.GioiTinh = ((Byte)(r.GetValue(ordinal)));
					}
					catch{}
					try
					{
						int ordinal = r.GetOrdinal("DiaChi");
						if (!r.IsDBNull(ordinal)) entity.DiaChi = ((string)(r.GetValue(ordinal)));
					}
					catch{}
					try
					{
						int ordinal = r.GetOrdinal("Email");
						if (!r.IsDBNull(ordinal)) entity.Email = ((string)(r.GetValue(ordinal)));
					}
					catch{}
					try
					{
						int ordinal = r.GetOrdinal("DienThoai");
						if (!r.IsDBNull(ordinal)) entity.DienThoai = ((string)(r.GetValue(ordinal)));
					}
					catch{}
					try
					{
						int ordinal = r.GetOrdinal("BoMon_ID");
						if (!r.IsDBNull(ordinal)) entity.BoMon_ID = ((int)(r.GetValue(ordinal)));
					}
					catch{}
					return entity;
				}
			}catch{}
			return null;
		}
		#endregion
	}
	/*****************************************************************************************************/
	/**********************************END GiaoVienDAOBase*****************************************/
	/*****************************************************************************************************/
}

